package thread1;

public class Demo6 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() -> {
            for(int i = 0; i < 3; i++){
                System.out.println("线程 t1 执行");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

        Thread t2 = new Thread(() -> {
            for(int i = 0; i < 3; i++){
                System.out.println("线程 t2 执行");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

//        t1.start();
//        t2.start();
//        t1.join();
//        t2.join();
//        System.out.println("线程 main 结束");

        Thread t = Thread.currentThread();
        System.out.println(t.getName());
        System.out.println(t.isAlive());

    }
}
